package com.hdaccp.xingmu.controller;

import com.hdaccp.xingmu.dao.UserDao;
import com.hdaccp.xingmu.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.persistence.EntityManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/users")
public class UserController {
    @Autowired
    private UserDao userDao;
    @Autowired
    private EntityManager entityManager;
    @RequestMapping("/login")
    @ResponseBody
    public int login(String loginName, String passWord){

        User user=userDao.findUserByLoginNameAndAndPassWord(loginName,passWord);
        int is = -1;
        if(user==null){

        }else{
            is=1;
        }
        return is;
    }


    @RequestMapping("/login2")
    public String login2(){
        return "kuangjia/index";
    }
}
